﻿using System.Data;
using DataAccess;
using EntitiesTM;

namespace Business
{
    public class BuClient
    {
        public static DataTable selAllClient(string companyid)
        {
            DaClient client = new DaClient();
            return client.selAllClient(companyid);
        }

        public static EnClient selClientByID(int clientID, string companyid)
        {
            DaClient client = new DaClient();
            DataRow data = client.selClientByID(clientID,companyid).Rows[0];
            //DataRow dtTmp = staffExist.GetStaffByEmailOpt(email).Rows[0];
            EnClient enClient = new EnClient();
            enClient.clientName = data["ClientName"].ToString();
            enClient.clientDes = data["ClientDescription"].ToString();
            enClient.clientAddress = data["ClientAddress"].ToString();
            enClient.contactPerson = data["ClientNameContactPerson"].ToString();
            enClient.url = data["ClientURL"].ToString();
            enClient.nameAlt = data["ClientNameAlt"].ToString();
            enClient.phone = data["ClientPhoneContactPerson"].ToString();
            enClient.email = data["ClientEmailContactPerson"].ToString();
            enClient.fax = data["ClientFaxContactPerson"].ToString();

            return enClient;
        }

        public static void insClient(EnClient client, string companyid)
        {
            DaClient daClient = new DaClient();
            daClient.insClient(client, companyid);
        }

        public static void updClient(EnClient client, string companyid)
        {
            DaClient daClient = new DaClient();
            daClient.updClient(client,companyid);
        }

        public static void delClient(int clientID, string companyid)
        {
            DaClient daClient = new DaClient();
            daClient.delClient(clientID, companyid);
        }
    }
}
